package day05;
import  java.util.Random;
/** 方法返回值的演示 */
public class MethodDemo2 {
    public static void main(String[] args) {
        int a = sum(5,6);//sum(5,6)的值就是retrun后面的那个数字
        System.out.println(a);//11---模拟对返回值的后续操作

        int m = 7,n=6;
        int b = sum(m,n);//给的是变量的形式
        System.out.println(b);//13---模拟对返回值的后续操作
        System.out.println("-------");


        int[] d = generateArray(1,10);
        for (int i = 0; i <d.length ; i++) {
            System.out.println(d[i]);
        }

        System.out.println("-------");

        int[]c = generateArray(6,65);
        System.out.println(c.length);

    }


    public static int[] generateArray(int len,int max){
        Random rand = new Random();
        int[] arr = new int[len];
        for (int i = 0; i <arr.length ; i++) {
            arr[i] = rand.nextInt(max+1);
        }
        return arr;
    }




    public static int sum (int num1,int num2){
        int num = num1+num2;
        return num;//返回的是num里面的那个数
    }
}
